package cn.scw.project.goods.service.impl;

import cn.scw.project.goods.domain.GCommodityModel;
import cn.scw.project.goods.domain.GCommodityOrder;
import cn.scw.project.goods.mapper.GCommodityModelMapper;
import cn.scw.project.goods.service.IGCommodityModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品规格Service业务层处理
 *
 * @author api
 * @date 2020-05-20
 */
@Service
public class GCommodityModelServiceImpl implements IGCommodityModelService
{
    @Autowired
    private GCommodityModelMapper gCommodityModelMapper;

    /**
     * 查询商品规格
     *
     * @param id 商品规格ID
     * @return 商品规格
     */
    @Override
    public GCommodityModel selectGCommodityModelById(Long id)
    {
        return gCommodityModelMapper.selectGCommodityModelById(id);
    }

    /**
     * 查询商品规格列表
     *
     * @param gCommodityModel 商品规格
     * @return 商品规格
     */
    @Override
    public List<GCommodityModel> selectGCommodityModelList(GCommodityModel gCommodityModel)
    {
        return gCommodityModelMapper.selectGCommodityModelList(gCommodityModel);
    }

    /**
     * 新增商品规格
     *
     * @param gCommodityModel 商品规格
     * @return 结果
     */
    @Override
    public int insertGCommodityModel(GCommodityModel gCommodityModel)
    {
        return gCommodityModelMapper.insertGCommodityModel(gCommodityModel);
    }

    /**
     * 修改商品规格
     *
     * @param gCommodityModel 商品规格
     * @return 结果
     */
    @Override
    public int updateGCommodityModel(GCommodityModel gCommodityModel)
    {
        return gCommodityModelMapper.updateGCommodityModel(gCommodityModel);
    }

    /**
     * 批量删除商品规格
     *
     * @param ids 需要删除的商品规格ID
     * @return 结果
     */
    @Override
    public int deleteGCommodityModelByIds(Long[] ids)
    {
        return gCommodityModelMapper.deleteGCommodityModelByIds(ids);
    }

    /**
     * 删除商品规格信息
     *
     * @param id 商品规格ID
     * @return 结果
     */
    @Override
    public int deleteGCommodityModelById(Long id)
    {
        return gCommodityModelMapper.deleteGCommodityModelById(id);
    }

    @Override
    public boolean existsByCommodityIdAndName(Long id, String name) {
        return gCommodityModelMapper.existsByCommodityIdAndName(id,name);
    }
}
